<!DOCTYPE html>
<html lang="en-US">
<head>
  <title>David Bardwell Homework 1 Part 1a</title>
  <meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
  <script type="text/javascript">
    // on load, instantiate our Employee type and Manager type and
    // display the salary for Employee and override getSalary function
    // for Manager.
    window.onload = function() {
      function Employee(name) {
          this.name = name;
      }
      
      Employee.prototype = {
        constructor : Employee,
        salary : 50000,
        getSalary : function() {
          return this.salary;
        }
      };
      
      // get our instance of the Employee type
      var myEmployee = new Employee("John Smith");
    
      var outputSalary = document.getElementById("outputEmployee");
      outputSalary.innerHTML = "Default salary for employee " + myEmployee.name + " is " + myEmployee.getSalary();
      
      function Manager(name) {
          this.name = name;
      }
      
      // get our instance of the Manager type
      Manager.prototype = new Employee();
      
      // override the Employee's getSalary function and return 50% more  
      Manager.prototype.getSalary = function() {
        return this.salary * 1.5;
      };
      
      var myManager = new Manager("Tim Johnson");
     
      outputSalary = document.getElementById("outputManager");
      outputSalary.innerHTML = "Salary for manager " + myManager.name + " based on employee prototype is " + myManager.getSalary();
    };
  </script>
</head>

<body>
    <div>
      <h2>Output for homework1 part 1a of assignment</h2>
      <p id="outputEmployee"> </p>
      <p id="outputManager"> </p>
    </div>  
</body>
